/*
+--------------------------
| FreeloaderOS v0.0.1
|  - Microkernel
+--------------------------
| Written by Alec Hussey
| Copyright (c) 2007
|  - Deus X Foundation
+---------------------------
*/

/*
 * Kernel Header
 */

#ifndef _SYSTEM_H
#define _SYSTEM_H

typedef int size_t;

//
// Stack Structure
//

struct regs
{
	unsigned int gs, fs, es, ds;
	unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax;
	unsigned int int_no, err_code;
	unsigned int eip, cs, eflags, useresp, ss;
};

//
// main.c
//

extern void outportb (unsigned short _port, unsigned char _data);
extern unsigned char inportb (unsigned short _port);
extern void panic(unsigned char *error, unsigned char *debug);

//
// screen.c
//

extern void scroll();
extern void move_csr();
extern void clear_screen();
extern int get_current_pos(char type);
extern void set_current_pos(char type, int new_pos);
extern void putch(unsigned char character);
extern void putstr(unsigned char *text);
extern void set_text_color(unsigned char forecolor, unsigned char backcolor);
extern void init_video();

//
// gdt.c
//

extern void gdt_set_gate(int num, 
                         unsigned long base, 
                         unsigned long limit, 
                         unsigned char access, 
                         unsigned char gran);
extern void init_gdt();

//
// idt.c
//

extern void idt_set_gate(unsigned char num, 
                         unsigned long base, 
                         unsigned short sel, 
                         unsigned char flags);
extern void init_idt();

//
// isrs.c
//

extern void init_isrs();

//
// irqs.c
//

extern void init_irq();
extern inline void irq_install_handler(int irq, void (*handler)(struct regs *r));
extern inline void irq_uninstall_handler(int irq);

//
// sysclock.c
//

extern void init_timer();
extern void timer_wait(int ticks);

//
// keyboard.c
//

extern unsigned int get_raw_key();
extern unsigned int read_raw_key();
extern const unsigned char get_char();

//
// beep.c
//

extern void beep(int ticks);

// ------------------
// MODULES
// ------------------

//
// mod_memtest
//

extern void init_memtest();

//
// mod_screensaver
//

extern void init_screensaver();

#endif
